﻿<%@ Page Language="C#" AutoEventWireup="true" Culture="en-GB" CodeFile="MPNReport.aspx.cs"
    Inherits="Main_Reports_Inventory_MPNReport" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="AjaxControl" %>
<%@ Register Src="~/User Controls/PageHeading.ascx" TagName="heading" TagPrefix="acc" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="../../../Styles/accounts.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" EnablePartialRendering="true">
        </asp:ScriptManager>
        <acc:heading ID="pagehead" runat="server" HeadingText="MPN Report" />
        <div style="width: 98%;">
            <table width="100%" style="background-color: #EEEEEE; height: 30px;">
                <tr>
                    <td>
                        <asp:Label ID="lblRecordNo" runat="server" Width="100px"></asp:Label>
                    </td>
                    <td>
                        <asp:Label ID="lblperiod" runat="server" Width="200px"></asp:Label>
                    </td>
                    <td style="width: 7.15%;">
                        <asp:Label ID="Label1" runat="server" Text="Column Name" Width="100px"></asp:Label>
                    </td>
                    <td style="width: 7.15%;">
                        <asp:DropDownList ID="ddlColumnname" runat="server" onchange="return ToHide_Show();"
                            CssClass="dropdown">
                            <asp:ListItem Value="0"> - Select Column(s) - </asp:ListItem>
                            <asp:ListItem Value="1">Bin No</asp:ListItem>
                            <asp:ListItem Value="2">Item Code</asp:ListItem>
                            <asp:ListItem Value="3">AltItem Code</asp:ListItem>
                            <asp:ListItem Value="4">MPN</asp:ListItem>
                            <asp:ListItem Value="5">ROL</asp:ListItem>
                            <asp:ListItem Value="6">Item Name</asp:ListItem>
                            <asp:ListItem Value="7">Project</asp:ListItem>
                        </asp:DropDownList>
                        <script type="text/javascript">
                            function ToHide_Show() {
                                if (document.getElementById("ddlColumnname").value != "0") {
                                }
                                else {
                                }
                                document.getElementById("txtValue").value = '';
                            }
                        </script>
                    </td>
                    <td style="width: 7.15%;">
                        <asp:Label ID="lblvalue" runat="server" Text="Value"></asp:Label>
                    </td>
                    <td style="width: 7.15%;">
                        <asp:TextBox ID="txtValue" CssClass="input" runat="server"></asp:TextBox>
                    </td>
                    <td style="width: 7.15%;">
                        <asp:Button ID="btnReport" runat="server" Text="Go" CssClass="button1" OnClick="btnReport_Click" />
                    </td>
                    <td style="width: 7.15%;">
                        From
                    </td>
                    <td style="width: 7.15%;">
                        <asp:TextBox ID="txtfromdate" Width="80px" CssClass="input" runat="server" onKeyPress="return isNumberKey(this.id,event);"></asp:TextBox>
                    </td>
                    <td style="width: 7.15%;">
                        <asp:ImageButton ID="imgfromdate" runat="server" ImageUrl="~/Images/calendar.gif" />
                        <AjaxControl:CalendarExtender ID="calFrom" runat="server" PopupButtonID="imgfromdate"
                            Format="dd/MM/yyyy" TargetControlID="txtfromdate">
                        </AjaxControl:CalendarExtender>
                    </td>
                    <td style="width: 7.15%;">
                        To
                    </td>
                    <td style="width: 7.15%;">
                        <asp:TextBox ID="txttodate" Width="80px" CssClass="input" runat="server" onKeyPress="return isNumberKey(this.id,event);"></asp:TextBox>
                    </td>
                    <td style="width: 7.15%;">
                        <asp:ImageButton ID="imgtoDate" runat="server" ImageUrl="~/Images/calendar.gif" />
                        <AjaxControl:CalendarExtender ID="calto" runat="server" PopupButtonID="imgtoDate"
                            Format="dd/MM/yyyy" TargetControlID="txttodate">
                        </AjaxControl:CalendarExtender>
                    </td>
                    <td style="width: 7.15%;">
                        <asp:Button ID="btngetreport" runat="server" Text="Go" CssClass="button1" OnClick="btngetreport_Click"
                            OnClientClick="return getcheck();" />
                        <script type="text/javascript">
                            function getcheck() {
                                if (document.getElementById("txtfromdate").value == '') {
                                    alert("Please Select From Date.");
                                    document.getElementById("txtfromdate").focus();
                                    return false;
                                }
                                else if (document.getElementById("txttodate").value == '') {
                                    alert("Please Select To Date.");
                                    document.getElementById("txttodate").focus();
                                    return false;
                                }
                            }
                        </script>
                    </td>
                    <td style="width: 7.15%;">
                        <asp:ImageButton ID="imgbtnPrint" runat="server" OnClientClick="printpanel();" ImageUrl="../../../Images/print.png" />&nbsp;
                        <script type="text/javascript">
                            function printpanel() {
                                var printcontent = document.getElementById('grdMPNView');
                                window.print(printcontent.innerHTML);
                            }
                        </script>
                    </td>
                    <td style="width: 7.15%;">
                        <asp:ImageButton ID="ImgBtnExcel" ToolTip="Export to Excel" runat="server" Height="15px"
                            ImageUrl="~/Images/Excel.png" OnClick="ImgBtnExcel_Click" />
                    </td>
                </tr>
            </table>
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                    <asp:GridView ID="grdMPNView" runat="server" ShowFooter="true" AutoGenerateColumns="false"
                        CssClass="gridview" AllowPaging="false" EmptyDataText="No Record Found !!" ShowHeaderWhenEmpty="True"
                        OnPageIndexChanging="grdMPNView_PageIndexChanging" Width="100%" OnRowDataBound="grdMPNView_RowDataBound">
                        <Columns>
                            <asp:TemplateField HeaderText="Sr.No">
                                <ItemTemplate>
                                    <%#Container.DataItemIndex+1%>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField HeaderText="Item Name" DataField="ITMDESC" />
                            <asp:BoundField HeaderText="Item Code" DataField="ITMCODE" />
                            <asp:BoundField HeaderText="MPN" DataField="MPNNO" />
                            <asp:BoundField HeaderText="Bin Ref" DataField="BINREF" />
                            <asp:BoundField HeaderText="Location ID" DataField="LOCATIONID" />
                            <asp:BoundField HeaderText="Item Group" DataField="ITEMGROUP" />
                            <asp:BoundField HeaderText="Item Addl Desc" DataField="ITEMADDLDESC" />
                            <asp:BoundField HeaderText="Alt Item Code" DataField="ALTITEMCODE" />
                            <asp:BoundField HeaderText="Project Name" DataField="PROJECTNAME" />
                            <asp:BoundField HeaderText="Leased Type" DataField="LEASEDTYPE" />
                            <asp:BoundField HeaderText="Total Transit Time [Days]" DataField="TOTALTRANSITTIME"
                                ItemStyle-HorizontalAlign="Right" />
                            <asp:BoundField HeaderText="Manufacture Name" DataField="MANUFACNAME" FooterText="Total" />
                            <asp:BoundField HeaderText="Opening Qty" DataField="OPENINGQTY" DataFormatString="{0:0}"
                                FooterStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" />
                            <asp:BoundField HeaderText="Purchase Qty" DataField="PURCHASEQTY" DataFormatString="{0:0}"
                                FooterStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" />
                            <asp:BoundField HeaderText="Issue Qty" DataField="ISSUEQTY" DataFormatString="{0:0}"
                                ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right" />
                            <asp:BoundField HeaderText="Return Qty" DataField="RETURNQTY" DataFormatString="{0:0}"
                                ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right" />
                            <asp:BoundField HeaderText="Closing Qty" DataField="CLOSINGQTY" DataFormatString="{0:0}"
                                ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right" />
                        </Columns>
                    </asp:GridView>
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
    </div>
    </form>
</body>
</html>
